package net.lookyou.boot.demo.mapper;

import net.lookyou.boot.demo.entity.SysUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface SysUserMapper {
    @Select("SELECT * FROM sys_user WHERE id = #{id}")
    SysUser selectById(Integer id);

    @Select("SELECT * FROM sys_user WHERE name = #{name}")
    SysUser selectByName(String name);

    @Insert("INSERT INTO sys_user (name,password) VALUES(#{name},#{passWord})")
    @Options(useGeneratedKeys=true, keyProperty="id", keyColumn="id")
    int addUser(String name, String passWord);
}
